package com.atguigu.gmall.item.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import com.atguigu.gmall.product.vo.SkuDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/inner/rpc/product")
public class ItemRpcController {

    @Autowired
    ItemService itemService;
    /**
     * 获取商品数据
     * @param skuId
     * @return
     */
    @GetMapping("sku/detail/{skuId}")
    public Result<SkuDetailVo> getItemDetail(@PathVariable Long skuId) throws InterruptedException {
        SkuDetailVo skuDetailVo = itemService.getItemDetail(skuId);
        return Result.ok(skuDetailVo);
    }
}
